subroutine mainVP(a,i,i_time)
    dimension a(100000000),i(100000000)
    common /commonInfo/ eps2d,eps3d,eps3dNS,radiusRED,maxiter,typeTask,nt,nMaterials,calcWK,calcVP
    real*8 a,eps2d,eps3d,eps3dNS,radiusRED
    integer calcWK,calcVP,vn2d_dat,vn3d_dat,va_dat,v0_dat,ax_dat,ay_dat,az_dat,&
    a_0000,wk2d_dat,wk3d_dat

    if(calcWK.eq.1)then
        call init_WK(a,i,i_vertex2D,i_nVer2D,i_nInCat2D,i_vertex3D,i_nVer3D,&
        i_nInCat3D,i_igT,i_jgT,i_ggT,i_ig,i_jg,i_ggl,i_ggu,i_di,i_f,i_l1,i_v1,&
        i_v2,i_v3,i_v4,i_v5,i_ggl2,i_ggu2,i_di2,i_igT3D,i_jgT3D,i_ggT3D,i_l13d,&
        i_ig3D,i_jg3D,i_params,i_igEarth,i_jgEarth,vn2d_dat,vn3d_dat,va_dat,&
        v0_dat,i_zLayers,i_xObjects,i_yObjects,i_zObjects,i_numbersObjects,nLayers,&
        nObjects,nXObjects,nYObjects,nZObjects,wk2d_dat,wk3d_dat,i_sigmaLayers,&
        i_sigmaObjects,i_areaObjects,i_areaType,layerType,nAreaObjects,&
        i_vnRZ,i_vnXYZ,i_va,i_v0,i_wnRZ,i_wnXYZ,i_wa)
        call calculateWK(a(i_vertex2D),i(i_nVer2D),i(i_nInCat2D),a(i_vertex3D),&
        a(i_params),i(i_nVer3D),i(i_nInCat3D),i(i_igT),i(i_jgT),a(i_ggT),i(i_ig),&
        i(i_jg),a(i_ggl),a(i_ggu),a(i_di),a(i_f),i(i_l1),a(i_v1),a(i_v2),a(i_v3),&
        a(i_v4),a(i_v5),a(i_ggl2),a(i_ggu2),a(i_di2),i(i_igT3D),i(i_jgT3D),&
        a(i_ggT3D),i(i_l13d),i(i_ig3D),i(i_jg3D),i(i_igEarth),i(i_jgEarth),&
        vn2d_dat,vn3d_dat,va_dat,v0_dat,a(i_zLayers),a(i_xObjects),a(i_yObjects),&
        a(i_zObjects),i(i_numbersObjects),nLayers,nObjects,nXObjects,&
        nYObjects,nZObjects,wk2d_dat,wk3d_dat,a(i_sigmaLayers),a(i_sigmaObjects),&
        i(i_areaObjects),i(i_areaType),layerType,nAreaObjects,&
        a(i_vnRZ),a(i_vnXYZ),a(i_va),a(i_v0),a(i_wnRZ),a(i_wnXYZ),a(i_wa))
    endif

    if(calcVP.eq.1)then
        call initVP(a,i,i_time,i_vertex3D,i_nVer3D,i_points,i_MN,i_alp,i_T0,&
        i_num,i_numbersEl,wk3d_dat,nMN,nPoints,nAreas)
        call calculateVP(a(i_time),a(i_vertex3D),i(i_nVer3D),a(i_points),a(i_MN),&
        a(i_alp),a(i_T0),i(i_num),i(i_numbersEl),wk3d_dat,nMN,nPoints,nAreas)
    endif
end
!*************************************************************************
!*************************************************************************
!*************************************************************************